package xiangmu.schoolpaper.controller.bingo.teacher;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xiangmu.schoolpaper.pojo.DTO.TeacherScoreByStudentAccountUpdateDTO;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.TeacherScoreService;

@RestController
@RequestMapping("/teacher/score")
@Slf4j
@Tag(name = "教师端——评分模块")
public class TeacherScoreController {
    @Autowired
    private TeacherScoreService teacherScoreService;

    @Operation(summary = "根据学生的id修改学生详细评分信息")
    @PostMapping("/update-paper-score-by-student-account")
    public Result updatePaperScoreByStudentAccount(@RequestBody TeacherScoreByStudentAccountUpdateDTO dto) {
        try {
            Boolean success = teacherScoreService.updatePaperScoreByStudentAccount(dto);
            return Result.success(success);
        } catch (RuntimeException e) {
            return Result.error(e.getMessage());
        }
    }
}
